function [f_xN_bfu] = make_f_xN_bfu(f_xnext,n,m,N,x0)

    function [vec_val] = proto_make_f_xN_bfu(bfu) 
        bfx = zeros(n*(N+1),1);
        bfx(1:n) = x0;
        for k = 1:N
            bfx(1+k*n:(k+1)*n) = f_xnext(bfx(1+(k-1)*n:k*n), bfu(1+(k-1)*m:k*m));
            % bfx(4k+1:4k+4) = f_xnext(bfx(4k-3:4k),bfu(2k-1:2k));
        end
        vec_val = bfx(1+N*n:(N+1)*n);
        % vec_val = bfx()
    end
f_xN_bfu = @proto_make_f_xN_bfu;
end